package com.liuym.classes.dubbo.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.liuym.classes.repository.model.bo.DepartBO;
import com.liuym.classes.service.DepartService;
import com.liuym.common.dubbo.depart.api.DepartDubboService;
import com.liuym.common.dubbo.depart.dto.DepartDTO;
import com.liuym.common.exception.DepartException;
import com.vip.vjtools.vjkit.mapper.BeanMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Liuym
 * @date 2019/1/23 15:22
 * @describe：
 */
@Service(version = "${depart.dubbo.version}")
public class DepartDubboServiceImpl implements DepartDubboService {

    @Autowired
    private DepartService departService;

    @Override
    public DepartDTO findById(int id) throws DepartException {
        DepartBO departBO = departService.findById(id);
        if (departBO != null) {
            DepartDTO departDTO = BeanMapper.map(departBO, DepartDTO.class);
            return departDTO;
        }
        return null;
    }
}
